package easy;

public class Solution_1646 {
    public int getMaximumGenerated(int n) {
        int max = 0;
        int[] array = new int[n + 1];
        for (int i = 0; i < array.length; i++) {
            if (i < 2) {
                array[i] = i;
            } else {
                int j = i >> 1;
                if (i % 2 == 0) {
                    array[i] = array[j];
                } else {
                    array[i] = array[j] + array[j + 1];
                }
            }
            max = Math.max(max, array[i]);
        }
        return max;
    }

    public static void main(String[] args) {
        Solution_1646 model = new Solution_1646();
        System.out.println(model.getMaximumGenerated(7));
        System.out.println(model.getMaximumGenerated(2));
        System.out.println(model.getMaximumGenerated(3));
    }
}
